package com.wl.thread.demo08;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) {
        new MyThread01().start();
        new Thread(new MyThread02()).start();
        FutureTask<Integer> futureTask = new FutureTask(new MyThread03());
        new Thread(futureTask).start();

        try {
            Integer integer = futureTask.get();
            System.out.println(integer);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
class MyThread01 extends Thread{
    @Override
    public void run() {
        System.out.println("MyThread01");
    }
}
class MyThread02 implements Runnable{

    @Override
    public void run() {
        System.out.println("MyThread02");
    }
}
class MyThread03 implements Callable<Integer>{

    @Override
    public Integer call() throws Exception {
        System.out.println("MyThread03");
        return 100;
    }
}